home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mgabra.zip / MGLANGC.ASM < prev    next >
Assembly Source File  |  1988-02-25  |  2KB  |  76 lines

  1. ;------------------------------------------------
  2. ; MGABRA! LINKAGE MACROS FOR TURBO C LANGUAGE
  3. ; these define how your language passes parameters
  4. ; to assembly language functions. As set now for
  5. ; example, the first paramter (PARM1) lies at offset
  6. ; 6 into the stack (for turbo and other c's). You must
  7. ; define the specifics for your language. Also are the
  8. ; general entry and exit routines that must be
  9. ; modified for your language. All callable routines
  10. ; return 1 int (16 bit) value. These are for TURBO-C.
  11. ; If your language requires you to cleanup the
  12. ; stack then you have to replace the zeros with
  13. ; the proper number of words to pop off
  14. ;------------------------------------------------
  15.  
  16. ;------------------------------------------------
  17. ; INPUT PARAMTERS - For C
  18. ;------------------------------------------------
  19.  
  20. PARM1    EQU    [BP+14]
  21. PARM2    EQU    [BP+16]
  22. PARM3    EQU    [BP+18]
  23. PARM4    EQU    [BP+20]
  24. PARM5    EQU    [BP+22]
  25. PARM6    EQU    [BP+24]
  26.  
  27. ;------------------------------------------------
  28. ; NEGATIVE OFFSET OF PSP FROM CS
  29. ;------------------------------------------------
  30.  
  31. PSPOFFSET    equ    10h
  32.  
  33. ;------------------------------------------------
  34. ; RETURN PARAMTERS - For C
  35. ;------------------------------------------------
  36.  
  37. RETHIGH    MACRO    VAL        ;to return high word of 32 bit return value
  38.     push    VAL
  39.     pop    dx
  40.     ENDM
  41.  
  42. RETVAL    MACRO    VAL        ;return normal 16 bit value or low word of
  43.     push    VAL        ;32 bit value
  44.     pop    ax
  45.     ENDM
  46.  
  47. ;------------------------------------------------
  48. ; ENTRY SETUP
  49. ;------------------------------------------------
  50.  
  51. LANGIN    MACRO                ;c entry routine
  52.     push    ds
  53.     push    es
  54.     push    di
  55.     push    si
  56.     push    bp
  57.     mov    bp, sp
  58.     ENDM
  59.  
  60. ;------------------------------------------------
  61. ; EXIT CLEANUP
  62. ;------------------------------------------------
  63.  
  64. LANGRET MACRO    WORDS            ;c exit routine
  65.     pop    bp
  66.     pop     si
  67.     pop     di
  68.     pop     es
  69.     pop     ds
  70.     ret
  71.     ENDM
  72.  
  73. ;------------------------------------------------
  74. ; END OF MGLANGC.ASM
  75. ;------------------------------------------------
  76.